﻿<UserControl xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"  x:Class="DemoNYTimes.TimesTagsPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"  
    xmlns:nyt="clr-namespace:NYTimes;assembly=NYTimesSilverlightKit"             
    xmlns:nytvc="clr-namespace:NYTimes.ValueConverters;assembly=NYTimesSilverlightKit"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
    <UserControl.Resources>
        <nyt:TimesTags x:Key="Tags" d:IsDataSource="true"/>
        <nytvc:DictionaryWebdingConverter x:Key="DictionaryWebdingConverter"/>
        <DataTemplate x:Key="TagResultTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="16"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock VerticalAlignment="Center" FontSize="16" FontFamily="Webdings" 
                           Text="{Binding Converter={StaticResource DictionaryWebdingConverter}, Path=Dictionary}" />
                <TextBlock Margin="4,0,0,0" VerticalAlignment="Center" FontFamily="Times New Roman" 
                           FontSize="12" Grid.Column="1" Text="{Binding Mode=OneWay, Path=Value}" 
                           TextWrapping="NoWrap"/>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <input:AutoCompleteBox x:Name="Query" 
                    Width="300"                      
                    VerticalAlignment="Center"
                    DataContext="{StaticResource Tags}" 
                    FilterMode="None"
                    IsTextCompletionEnabled="False" 
                    ItemsSource="{Binding Path=Tags}"
                    ItemTemplate="{StaticResource TagResultTemplate}" 
                    ValueMemberBinding="{Binding Path=Value}"
                    nyt:TimesTags.Service="{StaticResource Tags}"/>
    </Grid>
</UserControl>
